<template>
  <div class="d2-container-card">
    <div v-if="$slots.header" ref="header" class="d2-container-card__header">
      <slot name="header"></slot>
    </div>
    <div ref="body" class="d2-container-card__body">
      <div class="d2-container-card__body-card">
        <slot></slot>
      </div>
    </div>
    <div v-if="$slots.footer" ref="footer" class="d2-container-card__footer">
      <slot name="footer"></slot>
    </div>
  </div>
</template>

<script>
import scroll from "./mixins/normal";
export default {
  name: "D2ContainerCard",
  mixins: [scroll],
  mounted() {
    // 增加滚动事件监听
    this.addScrollListener();
  },
  beforeDestroy() {
    // 移除滚动事件监听
    this.removeScrollListener();
  },
};
</script>
